function [ axisLabel, axisHashYPosition ] = getAxisHashLabelGUI( ocrResults, axisOCRIndeces, axisHashYPosition, dicomImg, inputAxes, instructionText )

% Extract text from previously performed OCR

text = ocrResults.Words;

i = 1;

% Cycle through all detected text values in axis until a string is found
% correlating to an axis numeric value 

while i <= length(axisOCRIndeces);

    axisLabel = text(axisOCRIndeces(i));

    try
    
        axisLabel = str2num(axisLabel{1});
    
    catch ME        

    end

    % if any of the axis labels are incorrectly read as "positive", then
    % break out of loop and resort to defining the axis manually
    if axisLabel > 0
        axisLabel = [];
        break
        
    end
    
    %Makes sure that axisLabel is not an empty matrix (non-numeric text
    %is converted to an empty matrix with str2num). Also makes sure a valid
    %axisLabel has not already been found
    if isempty(axisLabel) == 0 && numel(axisHashYPosition) ~= 1 
        
        axisHashYPosition = axisHashYPosition(i);
        
    end
    
    i = i + 1;
    
end

% If axisLabel remains "cell", presume programmatic extraction failed and
% prompt user to define axis manually
if iscell(axisLabel)
    
    [ axisHashYPosition, axisLabel ] = getAxisManuallyGUI( dicomImg, inputAxes, instructionText );
    
end

% If axisLabel is an "empty matrix", presume programmatic extraction failed and
% prompt user to define axis manually
if isempty(axisLabel)
    
    [ axisHashYPosition, axisLabel ] = getAxisManuallyGUI( dicomImg, inputAxes, instructionText );
    
end

end

    
    